/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmMain.java
 *
 * Created on Nov 27, 2011, 11:51:07 PM
 */
package GUI;

import javax.swing.JOptionPane;

/**
 *
 * @author Dell
 */
public class FrmMain extends javax.swing.JFrame {
    private String username;
    private String password;
    /** Creates new form FrmMain */
    public FrmMain(String username, String password) {
             this.username = username;
        this.password = password;
        initComponents();
            this.lblOnline.setText(username + " is online!");
    }
    public void logOff() {
        menuQuanLyTaiKhoan.setEnabled(false);
        Funcition.setEnabled(false);
        Class.setEnabled(false);
        Nanny.setEnabled(false);
        Activity.setEnabled(false);
        Age.setEnabled(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenuBar3 = new javax.swing.JMenuBar();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenuBar4 = new javax.swing.JMenuBar();
        jMenu5 = new javax.swing.JMenu();
        jMenu6 = new javax.swing.JMenu();
        jMenuBar5 = new javax.swing.JMenuBar();
        jMenu7 = new javax.swing.JMenu();
        jMenu8 = new javax.swing.JMenu();
        jPanel1 = new javax.swing.JPanel();
        lblWallpaper = new javax.swing.JLabel();
        lblOnline = new javax.swing.JLabel();
        lblPiconline = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        menuUser = new javax.swing.JMenu();
        menuQuanLyTaiKhoan = new javax.swing.JMenuItem();
        menuDangNhap = new javax.swing.JMenuItem();
        menuDangXuat = new javax.swing.JMenuItem();
        menuThoat = new javax.swing.JMenuItem();
        Funcition = new javax.swing.JMenu();
        Child = new javax.swing.JMenuItem();
        Nanny = new javax.swing.JMenuItem();
        Class = new javax.swing.JMenuItem();
        Age = new javax.swing.JMenuItem();
        Activity = new javax.swing.JMenuItem();
        Help = new javax.swing.JMenu();
        Guide = new javax.swing.JMenuItem();
        Introduce = new javax.swing.JMenuItem();

        jMenu1.setText("File");
        jMenuBar2.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar2.add(jMenu2);

        jMenu3.setText("File");
        jMenuBar3.add(jMenu3);

        jMenu4.setText("Edit");
        jMenuBar3.add(jMenu4);

        jMenu5.setText("File");
        jMenuBar4.add(jMenu5);

        jMenu6.setText("Edit");
        jMenuBar4.add(jMenu6);

        jMenu7.setText("File");
        jMenuBar5.add(jMenu7);

        jMenu8.setText("Edit");
        jMenuBar5.add(jMenu8);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("ChildCare System");

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        lblOnline.setFont(new java.awt.Font("Tahoma", 0, 14));
        lblOnline.setForeground(new java.awt.Color(255, 0, 0));
        lblOnline.setText("lbl1");

        lblPiconline.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/online.jpg"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(lblPiconline, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 244, Short.MAX_VALUE)
                        .addComponent(lblWallpaper)
                        .addGap(128, 128, 128))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lblOnline, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(124, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 232, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(96, 96, 96))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblOnline, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(22, 22, 22)
                .addComponent(lblWallpaper)
                .addContainerGap(28, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(254, Short.MAX_VALUE)
                .addComponent(lblPiconline)
                .addGap(39, 39, 39))
        );

        menuUser.setForeground(new java.awt.Color(0, 0, 204));
        menuUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/system.jpg"))); // NOI18N
        menuUser.setText("System");

        menuQuanLyTaiKhoan.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        menuQuanLyTaiKhoan.setForeground(new java.awt.Color(0, 0, 204));
        menuQuanLyTaiKhoan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/users.png"))); // NOI18N
        menuQuanLyTaiKhoan.setText("Mangager User");
        menuQuanLyTaiKhoan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuQuanLyTaiKhoanActionPerformed(evt);
            }
        });
        menuUser.add(menuQuanLyTaiKhoan);

        menuDangNhap.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK));
        menuDangNhap.setForeground(new java.awt.Color(0, 0, 204));
        menuDangNhap.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/unlock1.png"))); // NOI18N
        menuDangNhap.setText("Login");
        menuDangNhap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuDangNhapActionPerformed(evt);
            }
        });
        menuUser.add(menuDangNhap);

        menuDangXuat.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        menuDangXuat.setForeground(new java.awt.Color(0, 0, 204));
        menuDangXuat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/lock.png"))); // NOI18N
        menuDangXuat.setText("Logout");
        menuDangXuat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuDangXuatActionPerformed(evt);
            }
        });
        menuUser.add(menuDangXuat);

        menuThoat.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        menuThoat.setForeground(new java.awt.Color(0, 0, 204));
        menuThoat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/delete.png"))); // NOI18N
        menuThoat.setText("Exit");
        menuThoat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuThoatActionPerformed(evt);
            }
        });
        menuUser.add(menuThoat);

        jMenuBar1.add(menuUser);

        Funcition.setForeground(new java.awt.Color(0, 0, 204));
        Funcition.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Computer.png"))); // NOI18N
        Funcition.setText("Functions");

        Child.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F2, 0));
        Child.setForeground(new java.awt.Color(0, 0, 204));
        Child.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/logo.png"))); // NOI18N
        Child.setText("Mangager Child");
        Child.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ChildActionPerformed(evt);
            }
        });
        Funcition.add(Child);

        Nanny.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F3, 0));
        Nanny.setForeground(new java.awt.Color(0, 0, 204));
        Nanny.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/User.png"))); // NOI18N
        Nanny.setText("Manager Nanny");
        Nanny.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                NannyActionPerformed(evt);
            }
        });
        Funcition.add(Nanny);

        Class.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, 0));
        Class.setForeground(new java.awt.Color(0, 0, 204));
        Class.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Class.png"))); // NOI18N
        Class.setText("Manager Class");
        Class.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ClassActionPerformed(evt);
            }
        });
        Funcition.add(Class);

        Age.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        Age.setForeground(new java.awt.Color(0, 0, 204));
        Age.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/chart.png"))); // NOI18N
        Age.setText("Manager Age Group");
        Age.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AgeActionPerformed(evt);
            }
        });
        Funcition.add(Age);

        Activity.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, 0));
        Activity.setForeground(new java.awt.Color(0, 0, 204));
        Activity.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Gamepad.png"))); // NOI18N
        Activity.setText("Manager Active");
        Activity.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ActivityActionPerformed(evt);
            }
        });
        Funcition.add(Activity);

        jMenuBar1.add(Funcition);

        Help.setForeground(new java.awt.Color(0, 0, 204));
        Help.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/help.png"))); // NOI18N
        Help.setText("Help");

        Guide.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.InputEvent.CTRL_MASK));
        Guide.setForeground(new java.awt.Color(0, 0, 204));
        Guide.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/rss.png"))); // NOI18N
        Guide.setText("Guide");
        Help.add(Guide);

        Introduce.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        Introduce.setForeground(new java.awt.Color(0, 0, 204));
        Introduce.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/info.png"))); // NOI18N
        Introduce.setText("About");
        Help.add(Introduce);

        jMenuBar1.add(Help);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-468)/2, (screenSize.height-407)/2, 468, 407);
    }// </editor-fold>//GEN-END:initComponents

private void menuQuanLyTaiKhoanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuQuanLyTaiKhoanActionPerformed
// TODO add your handling code here
           FrmQuanLyTaiKhoan frmquanlytaikhoan = new FrmQuanLyTaiKhoan();
            frmquanlytaikhoan.setVisible(true);

}//GEN-LAST:event_menuQuanLyTaiKhoanActionPerformed

private void menuDangXuatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDangXuatActionPerformed
// TODO add your handling code here:
            logOff();

}//GEN-LAST:event_menuDangXuatActionPerformed

private void menuThoatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuThoatActionPerformed
// TODO add your handling code here:
            int choice = JOptionPane.showConfirmDialog(this, "Are you exit?", "Exit",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (choice == JOptionPane.YES_OPTION) {
            System.exit(0);
        }
}//GEN-LAST:event_menuThoatActionPerformed

private void menuDangNhapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDangNhapActionPerformed
// TODO add your handling code here:
            this.dispose();
        Login login = new Login();
        login.setVisible(true);
}//GEN-LAST:event_menuDangNhapActionPerformed

private void AgeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AgeActionPerformed
// TODO add your handling code here:
    FrmQuanLyTuoi frmquanlytuoi = new FrmQuanLyTuoi();
    frmquanlytuoi.setVisible(true);
}//GEN-LAST:event_AgeActionPerformed

private void ClassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClassActionPerformed
// TODO add your handling code here:
            FrmQuanLyLop frmquanlylop = new FrmQuanLyLop();
    frmquanlylop.setVisible(true);
}//GEN-LAST:event_ClassActionPerformed

private void NannyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NannyActionPerformed
// TODO add your handling code here:
        FrmQuanLyBaoMau1 frmquanlybaomau = new FrmQuanLyBaoMau1();
    frmquanlybaomau.setVisible(true);
}//GEN-LAST:event_NannyActionPerformed

private void ChildActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ChildActionPerformed
// TODO add your handling code here:
            FrmQuanLyTre frmquanlytre = new FrmQuanLyTre();
        frmquanlytre.setVisible(true);
}//GEN-LAST:event_ChildActionPerformed

private void ActivityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ActivityActionPerformed
// TODO add your handling code here:
    FrmQuanlyhoatdong frmquanlyhoatdong = new FrmQuanlyhoatdong();
    frmquanlyhoatdong.setVisible(true);
}//GEN-LAST:event_ActivityActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FrmMain(null,null).setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem Activity;
    private javax.swing.JMenuItem Age;
    private javax.swing.JMenuItem Child;
    private javax.swing.JMenuItem Class;
    private javax.swing.JMenu Funcition;
    private javax.swing.JMenuItem Guide;
    private javax.swing.JMenu Help;
    private javax.swing.JMenuItem Introduce;
    private javax.swing.JMenuItem Nanny;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenu jMenu8;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenuBar jMenuBar3;
    private javax.swing.JMenuBar jMenuBar4;
    private javax.swing.JMenuBar jMenuBar5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lblOnline;
    private javax.swing.JLabel lblPiconline;
    private javax.swing.JLabel lblWallpaper;
    private javax.swing.JMenuItem menuDangNhap;
    private javax.swing.JMenuItem menuDangXuat;
    private javax.swing.JMenuItem menuQuanLyTaiKhoan;
    private javax.swing.JMenuItem menuThoat;
    private javax.swing.JMenu menuUser;
    // End of variables declaration//GEN-END:variables
}
